var hzWeek= new Array("日","一","二","三","四","五","六","日");function cweekday(wday){return hzWeek[wday];}

var date = new Date();
var nowYear = date.getFullYear();
var nowMonth = date.getMonth()+1;
var nowDay = date.getDate();
jQuery('#curDate').val(nowYear+"-"+nowMonth+"-"+nowDay);

function cala()
{
curDate=document.getElementById("curDate").value;
var curNewDate = new Date(Date.parse(curDate.replace(/-/g, "/")));
ddd=document.getElementById("decday").value;

ttt=curNewDate.getTime()+ddd*24000*3600;

theday=new Date();
theday.setTime(ttt);

document.getElementById("result1").innerHTML=theday.getFullYear()+"年"+(1+theday.getMonth())+"月"+theday.getDate()+"日"+"星期"+cweekday(theday.getDay());
}

function calb()
{
var beforeDate = jQuery('#beforeDate').val();
var afterDate = jQuery('#afterDate').val();
var beforeNewDate = new Date(Date.parse(beforeDate.replace(/-/g, "/")));
var afterNewDate = new Date(Date.parse(afterDate.replace(/-/g, "/")));

document.getElementById("result2").innerHTML=(afterNewDate-beforeNewDate)/86400000+"天";
}